<!DOCTYPE html>
<html lang="zh-cn">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
	<title>登陆</title>

	<link href="__ROOT__/static/css/bootstrap.min.css" rel="stylesheet" />
	<link href="__ROOT__/static/css/common.css" rel="stylesheet" />
	<link href="__ROOT__/static/index/wxgzh/css/index.css" rel="stylesheet" />
	<style>
	</style>

</head>

<body>
	<br /><br /><br />
	<!--1.3 下面   手机下 微信登陆页  只在手机下显示  平行于1.3 引导页-->
	<h6>电脑浏览器下，请用手机尺寸模拟，才可见。</h6>
	<div class=" login-sj visible-xs text-center">
		<div class="thumbnail">
			<img src="__ROOT__/static/index/img/wx.png" alt="">
			<div class="caption">
				<h3>微信第三方登陆</h3>
				<h3>
					<!--需要 公众号设置 功能设置 网页授权域名中 修改-->
					<!--<a href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9aacf08f3fbd2e37&redirect_uri=http://www.bjlya.com/wxgzh/Login/person&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect">微信第三方登陆 </a>-->
					<a href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9aacf08f3fbd2e37&redirect_uri=http://www.hyhthjk.com.cn/note.php/wx/index3/person&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"><button
						 class="btn btn-success">点击登陆</button> </a>

				</h3>
			</div>
		</div>
	</div>
	<!--1.3 上面   手机下 微信登陆页 平行于1.3 引导页-->
	<hr>
	<pre>
   <h6>页面部分</h6>
   &lt;div class=" login-sj visible-xs text-center"&gt;
   &lt;div class="thumbnail"&gt;
	   &lt;img src="__ROOT__/static/index/img/wx.png" alt=""&gt;
	   &lt;div class="caption"&gt;
		   &lt;h3&gt;微信第三方登陆&lt;/h3&gt;
		   &lt;h3&gt;
			   &lt;!--需要 公众号设置 功能设置 网页授权域名中 修改--&gt;
			   &lt;!--&lt;a href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9aacf08f3fbd2e37&redirect_uri=http://www.bjlya.com/wxgzh/Login/person&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"&gt;微信第三方登陆 &lt;/a&gt;--&gt;
			   &lt;a href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9aacf08f3fbd2e37&redirect_uri=http://www.hyhthjk.com.cn/note.php/wx/index3/person&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect"&gt;&lt;button
					class="btn btn-success"&gt;点击登陆&lt;/button&gt; &lt;/a&gt;

		   &lt;/h3&gt;
	   &lt;/div&gt;
   &lt;/div&gt;
&lt;/div&gt;
<hr/>


<h6>php</h6>
public function person(Request $request)
{

// 1 获取到code
	//接收这个地址发来的 code 信息 https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx9aacf08f3fbd2e37&redirect_uri=http://www.bjlya.com/kehuweixiu/Login/person&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect
$code = input('get.code');
$appid = 'wx9aacf08f3fbd2e37';  //老板商城的
$secret = '79e22c79bea07f18456fa2c09ceb842b';   //老板商城的	
	//用 code 换取票据
	$url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=$appid&secret=$secret&code=$code&grant_type=authorization_code";

   $data = file_get_contents($url); 
   $data = json_decode($data,true);  //加 true 使json 转成数组 
   //从data中 获得 $access_token  openid 然后组成下面的地址
  
   $access_token = $data['access_token'];
  
	$openid = $data['openid'];
   $url = "https://api.weixin.qq.com/sns/userinfo?access_token=$access_token&openid=$openid&lang=zh_CN";
   $data = file_get_contents($url); 
   dump($data);
   // 3. 拉取用户openid
   //转成数组
   $data = json_decode($data,true);  //加 true 使json 转成数组 
   dump($data['openid']);
}


	</pre>
	<!--公共js区-->
	<script src="__ROOT__/static/js/jquery.min.js"></script>
	<script src="__ROOT__/static/js/bootstrap.min.js"></script>
</body>

</html>